package com.inputabc.qrcoderv1.ui.mainform.component;

import com.formdev.flatlaf.FlatIntelliJLaf;
import com.inputabc.EzGUIFramework.util.alias.Ez;
import com.inputabc.qrcoderv1.ui.mainform.event.EventHandler;
import com.inputabc.qrcoderv1.util.CacheConfig;
import lombok.Data;

import javax.swing.*;
import java.awt.*;

/**
 * 主窗体
 *
 * @author gaoweiyi
 */
@Data
public class MainFrame extends JFrame {
    public static final Dimension dimension = new Dimension(854, 480);
    private MainPanel mainPanel = new MainPanel();

    public MainFrame() {
        init();
    }

    public void init() {

        setName("mainFrame");
        mainPanel.setName("mainPanel");
        CacheConfig.mainFrame = this;
        setContentPane(mainPanel);
        setIconImage(new ImageIcon(Toolkit.getDefaultToolkit().getImage(
                MainFrame.class.getResource("/img/icon.png")
        )).getImage());
        setTitle("二维码制作工具");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Ez.removeButtonDottedLine(this);
        setSize(dimension);
        Ez.center(this);
        setResizable(false);
        new EventHandler().event(this);
        setVisible(true);
    }
}
